#include <iostream>
#include <opencv2/opencv.hpp>
using namespace cv;
using namespace std;

int main() {
  Mat src = imread("../images/2.jpg");
  if (src.empty()) {
    cout << "could not load image.." << endl;
    return -1;
  }
  namedWindow("opencv setup demo", CV_WINDOW_AUTOSIZE);
  imshow("opencv setup demo", src);

  Mat dst1, dst2;

  char src_title[] = "sourceimage";
  char dst_title1[] = "medianBlur";
  char dst_title2[] = "biblur";
  medianBlur(src, dst1, 3);
  imshow(dst_title1, dst1);
  bilateralFilter(src, dst2, 15, 30, 5);
  imshow(dst_title2, dst2);

  Mat dst3;
  Mat kernel = (Mat_<int>(3, 3) << 0, -1, 0, -1, 5, -1, 0, -1, 0);
  filter2D(dst2, dst3, -1, kernel, Point(-1, -1), 0);
  imshow("Filter result", dst3);
  waitKey(0);
  return 0;
}